import plotly.express as px
df = px.data.iris()
fig = px.scatter(df,x="sepal_width",y="sepal_length",color="species",
marginal_y="violin",
marginal_x="box",trendline="ols",template="simple_white"
)
fig.show()
import plotly.express as px
df = px.data.gapminder()
fig = px.scatter(df,x="gdpPercap",y="lifeExp",color="continent",
animation_frame="year",animation_group="country",
size="pop",hover_name="country",facet_col="continent",
log_x=True,size_max=45,range_x=[100,100000],range_y=[25,98])
fig.show()
import plotly.express as px
df = px.data.gapminder().query("year == 2007").query("continent == 'Europe'")
df.loc[df['pop']< 2.e6,'country'] = 'other countries'
# Represent only large countries
fig = px.pie(df,values="pop",names="country",title="Population of European continent")
fig.show()
import plotly.express as px
df = px.data.gapminder().query("year == 2007")
fig = px.sunburst(df,path=['continent','country'],values="pop",
color="lifeExp",hover_data = ['iso_alpha'])
fig.show()